home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / vbec20 / setup.exe / file0010.bin (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-01-23  |  12.1 KB  |  301 lines

  1. VERSION 5.00
  2. Begin VB.Form frmVBErrCatch 
  3.    Caption         =   "UNEXPECTED PROGRAM ERROR"
  4.    ClientHeight    =   4452
  5.    ClientLeft      =   48
  6.    ClientTop       =   276
  7.    ClientWidth     =   5916
  8.    ControlBox      =   0   'False
  9.    Icon            =   "VBErrCatch.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4452
  12.    ScaleWidth      =   5916
  13.    StartUpPosition =   2  'CenterScreen
  14.    Begin VB.CommandButton Command2 
  15.       Caption         =   "&Retry"
  16.       Height          =   564
  17.       Index           =   2
  18.       Left            =   2064
  19.       TabIndex        =   4
  20.       Top             =   3840
  21.       Width           =   924
  22.    End
  23.    Begin VB.CommandButton Command2 
  24.       Caption         =   "&Ignore"
  25.       Height          =   564
  26.       Index           =   1
  27.       Left            =   1056
  28.       TabIndex        =   3
  29.       Top             =   3840
  30.       Width           =   924
  31.    End
  32.    Begin VB.CommandButton Command2 
  33.       Caption         =   "&Abort"
  34.       Height          =   564
  35.       Index           =   0
  36.       Left            =   48
  37.       TabIndex        =   2
  38.       Top             =   3840
  39.       Width           =   924
  40.    End
  41.    Begin VB.CommandButton Command1 
  42.       Caption         =   "&Send Bug Report"
  43.       Height          =   564
  44.       Left            =   4392
  45.       Picture         =   "VBErrCatch.frx":0442
  46.       Style           =   1  'Graphical
  47.       TabIndex        =   5
  48.       Top             =   3840
  49.       Width           =   1500
  50.    End
  51.    Begin VB.Frame Frame2 
  52.       Caption         =   "How did you obtained the error?"
  53.       Height          =   876
  54.       Left            =   48
  55.       TabIndex        =   7
  56.       Top             =   2856
  57.       Width           =   5844
  58.       Begin VB.TextBox Text2 
  59.          Height          =   564
  60.          Left            =   96
  61.          MultiLine       =   -1  'True
  62.          TabIndex        =   1
  63.          Top             =   216
  64.          Width           =   5628
  65.       End
  66.    End
  67.    Begin VB.Frame Frame1 
  68.       Caption         =   "Error Details"
  69.       Height          =   2724
  70.       Left            =   48
  71.       TabIndex        =   0
  72.       Top             =   72
  73.       Width           =   5820
  74.       Begin VB.TextBox Text1 
  75.          BackColor       =   &H8000000F&
  76.          BeginProperty Font 
  77.             Name            =   "Courier"
  78.             Size            =   9.6
  79.             Charset         =   0
  80.             Weight          =   400
  81.             Underline       =   0   'False
  82.             Italic          =   0   'False
  83.             Strikethrough   =   0   'False
  84.          EndProperty
  85.          Height          =   2412
  86.          Left            =   120
  87.          Locked          =   -1  'True
  88.          MultiLine       =   -1  'True
  89.          TabIndex        =   6
  90.          TabStop         =   0   'False
  91.          Text            =   "VBErrCatch.frx":0884
  92.          Top             =   240
  93.          Width           =   5580
  94.       End
  95.    End
  96. Attribute VB_Name = "frmVBErrCatch"
  97. Attribute VB_GlobalNameSpace = False
  98. Attribute VB_Creatable = False
  99. Attribute VB_PredeclaredId = True
  100. Attribute VB_Exposed = False
  101. Option Explicit
  102. ' VBECSkipModule - Do not remove this line !
  103. Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
  104. '**************************************************************************
  105. ' Visual Basic declarations for the MAPI functions.
  106. '**************************************************************************
  107. '***************************************************
  108. '   MAPI Message holds information about a message
  109. '***************************************************
  110. Private Type MAPIMessage
  111.     Reserved As Long
  112.     Subject As String
  113.     NoteText As String
  114.     MessageType As String
  115.     DateReceived As String
  116.     ConversationID As String
  117.     Flags As Long
  118.     RecipCount As Long
  119.     FileCount As Long
  120. End Type
  121. '************************************************
  122. '   MAPIRecip holds information about a message
  123. '   originator or recipient
  124. '************************************************
  125. Private Type MapiRecip
  126.     Reserved As Long
  127.     RecipClass As Long
  128.     Name As String
  129.     Address As String
  130.     EIDSize As Long
  131.     EntryID As String
  132. End Type
  133. '******************************************************
  134. '   MapiFile holds information about file attachments
  135. '******************************************************
  136. Private Type MapiFile
  137.     Reserved As Long
  138.     Flags As Long
  139.     Position As Long
  140.     PathName As String
  141.     FileName As String
  142.     FileType As String
  143. End Type
  144. '***************************
  145. '   FUNCTION Declarations
  146. '***************************
  147. Private Declare Function MAPILogon Lib "MAPI32.DLL" (ByVal UIParam&, ByVal User$, ByVal Password$, ByVal Flags&, ByVal Reserved&, Session&) As Long
  148. Private Declare Function MAPILogoff Lib "MAPI32.DLL" (ByVal Session&, ByVal UIParam&, ByVal Flags&, ByVal Reserved&) As Long
  149. Private Declare Function BMAPIReadMail Lib "MAPI32.DLL" (lMsg&, nRecipients&, nFiles&, ByVal Session&, ByVal UIParam&, MessageID$, ByVal Flag&, ByVal Reserved&) As Long
  150. Private Declare Function BMAPIGetReadMail Lib "MAPI32.DLL" (ByVal lMsg&, Message As MAPIMessage, recip() As MapiRecip, File() As MapiFile, Originator As MapiRecip) As Long
  151. Private Declare Function MAPIFindNext Lib "MAPI32.DLL" Alias "BMAPIFindNext" (ByVal Session&, ByVal UIParam&, MsgType$, SeedMsgID$, ByVal Flag&, ByVal Reserved&, MsgID$) As Long
  152. Private Declare Function MAPISendDocuments Lib "MAPI32.DLL" (ByVal UIParam&, ByVal DelimStr$, ByVal FilePaths$, ByVal FileNames$, ByVal Reserved&) As Long
  153. Private Declare Function MAPIDeleteMail Lib "MAPI32.DLL" (ByVal Session&, ByVal UIParam&, ByVal MsgID$, ByVal Flags&, ByVal Reserved&) As Long
  154. Private Declare Function MAPISendMail Lib "MAPI32.DLL" Alias "BMAPISendMail" (ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient() As MapiRecip, File() As MapiFile, ByVal Flags&, ByVal Reserved&) As Long
  155. Private Declare Function MAPISaveMail Lib "MAPI32.DLL" Alias "BMAPISaveMail" (ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient() As MapiRecip, File() As MapiFile, ByVal Flags&, ByVal Reserved&, MsgID$) As Long
  156. Private Declare Function BMAPIAddress Lib "MAPI32.DLL" (lInfo&, ByVal Session&, ByVal UIParam&, Caption$, ByVal nEditFields&, Label$, nRecipients&, recip() As MapiRecip, ByVal Flags&, ByVal Reserved&) As Long
  157. Private Declare Function BMAPIGetAddress Lib "MAPI32.DLL" (ByVal lInfo&, ByVal nRecipients&, Recipients() As MapiRecip) As Long
  158. Private Declare Function MAPIDetails Lib "MAPI32.DLL" Alias "BMAPIDetails" (ByVal Session&, ByVal UIParam&, Recipient As MapiRecip, ByVal Flags&, ByVal Reserved&) As Long
  159. Private Declare Function MAPIResolveName Lib "MAPI32.DLL" Alias "BMAPIResolveName" (ByVal Session&, ByVal UIParam&, ByVal UserName$, ByVal Flags&, ByVal Reserved&, Recipient As MapiRecip) As Long
  160. 'Declare Function MAPILogon Lib "MAPI32.DLL" (ByVal UIParam As Long, ByVal Profile As String, ByVal Password As String, ByVal Flags As Long, ByVal Reserved As Long, Session As Long) As Long
  161. 'Declare Function MAPILogoff Lib "MAPI32.DLL" (ByVal Session As Byte, UIParam As Long, ByVal Flags As Long, ByVal Reserved As Long) As Long
  162. 'Declare Function MAPISendMail Lib "MAPI32.DLL" (ByVal Session As Long, ByVal UIParam As Long, Message As MAPIMessage, ByVal Flags As Long, ByVal Reserved As Long) As Long
  163. 'Declare Function Copy2Addr Lib "kernel32" Alias "lstrcpy" (ByVal lpDest As Long, ByVal lpSrc As String) As Long
  164. 'Declare Function Copy2Var Lib "kernel32" Alias "lstrcpy" (lpDest As Any, lpSrc As Any) As Long
  165. 'Declare Function LocalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal wBytes As Long) As Long
  166. 'Declare Function LocalFree Lib "kernel32" (ByVal hMem As Long) As Long
  167. '**************************
  168. '   CONSTANT Declarations
  169. '**************************
  170. Const SUCCESS_SUCCESS = 0
  171. Const MAPI_USER_ABORT = 1
  172. Const MAPI_E_USER_ABORT = MAPI_USER_ABORT
  173. Const MAPI_E_FAILURE = 2
  174. Const MAPI_E_LOGIN_FAILURE = 3
  175. Const MAPI_E_LOGON_FAILURE = MAPI_E_LOGIN_FAILURE
  176. Const MAPI_E_DISK_FULL = 4
  177. Const MAPI_E_INSUFFICIENT_MEMORY = 5
  178. Const MAPI_E_BLK_TOO_SMALL = 6
  179. Const MAPI_E_TOO_MANY_SESSIONS = 8
  180. Const MAPI_E_TOO_MANY_FILES = 9
  181. Const MAPI_E_TOO_MANY_RECIPIENTS = 10
  182. Const MAPI_E_ATTACHMENT_NOT_FOUND = 11
  183. Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
  184. Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
  185. Const MAPI_E_UNKNOWN_RECIPIENT = 14
  186. Const MAPI_E_BAD_RECIPTYPE = 15
  187. Const MAPI_E_NO_MESSAGES = 16
  188. Const MAPI_E_INVALID_MESSAGE = 17
  189. Const MAPI_E_TEXT_TOO_LARGE = 18
  190. Const MAPI_E_INVALID_SESSION = 19
  191. Const MAPI_E_TYPE_NOT_SUPPORTED = 20
  192. Const MAPI_E_AMBIGUOUS_RECIPIENT = 21
  193. Const MAPI_E_AMBIG_RECIP = MAPI_E_AMBIGUOUS_RECIPIENT
  194. Const MAPI_E_MESSAGE_IN_USE = 22
  195. Const MAPI_E_NETWORK_FAILURE = 23
  196. Const MAPI_E_INVALID_EDITFIELDS = 24
  197. Const MAPI_E_INVALID_RECIPS = 25
  198. Const MAPI_E_NOT_SUPPORTED = 26
  199. Const MAPI_ORIG = 0
  200. Const MAPI_TO = 1
  201. Const MAPI_CC = 2
  202. Const MAPI_BCC = 3
  203. '***********************
  204. '   FLAG Declarations
  205. '***********************
  206. '* MAPILogon() flags *
  207. Const MAPI_LOGON_UI = &H1
  208. Const MAPI_NEW_SESSION = &H2
  209. Const MAPI_FORCE_DOWNLOAD = &H1000
  210. '* MAPILogoff() flags *
  211. Const MAPI_LOGOFF_SHARED = &H1
  212. Const MAPI_LOGOFF_UI = &H2
  213. '* MAPISendMail() flags *
  214. Const MAPI_DIALOG = &H8
  215. '* MAPIFindNext() flags *
  216. Const MAPI_UNREAD_ONLY = &H20
  217. Const MAPI_GUARANTEE_FIFO = &H100
  218. '* MAPIReadMail() flags *
  219. Const MAPI_ENVELOPE_ONLY = &H40
  220. Const MAPI_PEEK = &H80
  221. Const MAPI_BODY_AS_FILE = &H200
  222. Const MAPI_SUPPRESS_ATTACH = &H800
  223. '* MAPIDetails() flags *
  224. Const MAPI_AB_NOMODIFY = &H400
  225. '* Attachment flags *
  226. Const MAPI_OLE = &H1
  227. Const MAPI_OLE_STATIC = &H2
  228. '* MapiMessage flags *
  229. Const MAPI_UNREAD = &H1
  230. Const MAPI_RECEIPT_REQUESTED = &H2
  231. Const MAPI_SENT = &H4
  232. Private Sub Command1_Click()
  233.     Dim hSession As Long, res As Long
  234.     Dim mailmsg As MAPIMessage
  235.     Dim recips(1) As MapiRecip
  236.     Dim NoFile(1) As MapiFile
  237.     On Error GoTo MapiError
  238.     mailmsg.Subject = UCase$(App.EXEName) & " BUG REPORT"
  239.     mailmsg.NoteText = Text1.Text & vbCrLf & vbCrLf & _
  240.                        "HOW I OBTAINED THE ERROR:" & vbCrLf & vbCrLf & _
  241.                        Text2.Text
  242.     mailmsg.FileCount = 0
  243.     mailmsg.RecipCount = 1
  244.     mailmsg.Flags = MAPI_RECEIPT_REQUESTED
  245.     recips(0).RecipClass = MAPI_TO
  246.     recips(0).Address = "SMTP:" & yourEmailAddr
  247.     recips(0).Name = yourName
  248.     res = MAPISendMail(0, 0, mailmsg, recips(), NoFile(), MAPI_LOGON_UI, 0&)
  249.     If res = SUCCESS_SUCCESS Then
  250.         MsgBox "Bug Report E-MAILED to " & yourName & " !!!!", vbInformation
  251.     End If
  252.     Exit Sub
  253. MapiError:
  254.     MsgBox "Error " & Err & ": " & Err.Description
  255. End Sub
  256. Private Sub ErrLog(sRep As String)
  257.     Dim ff As Long, fn As String, separator As String
  258.     separator = String(78, "-")
  259.     ff = FreeFile
  260.     fn = App.Path & "\VBECLog.txt"
  261.     Open fn For Append As ff
  262.     Print #ff, Text1.Text
  263.     Print #ff, ""
  264.     If Trim$(Text2.Text) <> "" Then
  265.         Print #ff, Text2.Text
  266.         Print #ff, ""
  267.     End If
  268.     Print #ff, sRep
  269.     Print #ff, separator
  270.     Close ff
  271. End Sub
  272. Private Sub Command2_Click(Index As Integer)
  273.     Dim sRep As String
  274.     Select Case Index
  275.     Case 0
  276.         VBECUserReply = vbAbort
  277.         sRep = "Pressed Abort..."
  278.     Case 1
  279.         VBECUserReply = vbIgnore
  280.         sRep = "Pressed Ignore..."
  281.     Case 2
  282.         VBECUserReply = vbRetry
  283.         sRep = "Pressed Retry..."
  284.     End Select
  285.     ErrLog sRep
  286.     Unload Me
  287. End Sub
  288. Property Let ErrDetails(s As String)
  289.     Text1.Text = s
  290. End Property
  291. Private Sub Form_Load()
  292.     ' check if MAPI is installed
  293.     Dim MapiFlag As Long
  294.     MapiFlag = GetPrivateProfileInt("MAIL", "MAPI", "-1", "WIN.INI")
  295.     Command1.Enabled = (MapiFlag = 1)
  296.     If yourEmailAddr = "" Then
  297.         Command1.Enabled = False
  298.         Command1.ToolTipText = "Programmer E-Mail address not available."
  299.     End If
  300. End Sub
  301.